package github.flandre.examplemod.common.energy.block;

import github.flandre.examplemod.common.energy.tileentity.FEDemoGeneratorTileEntity;
import github.flandre.examplemod.common.energy.tileentity.FEDemoMachineTileEntity;
import github.flandre.examplemod.core.init.Itemgroup.ExampleGroup;
import github.flandre.examplemod.examplemod;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ObjectHolder;

import javax.annotation.Nonnull;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class FEDemoGeneratorBlock extends Block
{
    public static final String NAME = "examplemod:generator";

    @ObjectHolder(NAME)
    public static FEDemoGeneratorBlock BLOCK;

    @SubscribeEvent
    public static void onRegisterBlock(@Nonnull RegistryEvent.Register<Block> event)
    {
        event.getRegistry().register(new FEDemoGeneratorBlock().setRegistryName(NAME));
    }

    @SubscribeEvent
    public static void onRegisterItem(@Nonnull RegistryEvent.Register<Item> event)
    {
        event.getRegistry().register(new BlockItem(BLOCK, new Item.Properties().group(ExampleGroup.exampleGroup)).setRegistryName(NAME));
    }

    private FEDemoGeneratorBlock()
    {
        super(Block.Properties.create(Material.IRON).hardnessAndResistance(3));
    }

    @Override
    public boolean hasTileEntity(@Nonnull BlockState state)
    {
        return true;
    }

    @Override
    public TileEntity createTileEntity(@Nonnull BlockState state, @Nonnull IBlockReader world)
    {
        return FEDemoGeneratorTileEntity.TILE_ENTITY_TYPE.create();
    }


}